<?php
/**
 * 
 * TagMap table model
 *
 * @category Abovo
 * 
 * @package Abovo_Model
 * 
 * @author Antti Holvikari <anttih@gmail.com>
 * 
 * @license http://opensource.org/licenses/bsd-license.php BSD
 * 
 */

/**
 * 
 * TagMap table model
 * 
 * @category Abovo
 * 
 * @package Abovo_Model
 * 
 */
class Abovo_Model_TagMap extends Solar_Sql_Table {
    
    /**
     * 
     * Constructor
     * 
     * We are overwriting constructor because we need the tables to
     * be created for Abovo_Model_Tag and so we call _connect() here.
     * 
     * @return void
     * 
     */
    public function __construct($config = array())
    {
        parent::__construct($config);
        $this->_connect();
    }
    
    /**
     * 
     * Table setup
     * 
     * @return void
     * 
     */
    protected function _setup()
    {
        $this->_name = 'tagmap';
        
        $this->_col['tags_id'] = array(
            'type'    => 'int',
            'require' => true,
        );
        
        $this->_col['handle'] = array(
            'type'    => 'varchar',
            'size'    => 15,
            'require' => false,
        );
        
        $this->_col['area'] = array(
            'type'    => 'char',
            'size'    => 10,
            'require' => true,
        );
        
        $this->_col['node_id'] = array(
            'type'    => 'int',
            'require' => true,
        );
        
        // Make sure sql is available
        if (! Solar::isRegistered('sql')) {
            Solar::register('sql', Solar::factory('Solar_Sql'));
        }
    }
}
